package com.lc.luzhengtang.util;

import android.util.Base64;

import java.io.File;
import java.io.FileInputStream;

/**
 * Created by DR on 2016/4/19.
 */
public class Base64Util {

    public static String encodeBase64File(String path) throws Exception {

        File file = new File(path);

        FileInputStream inputFile = new FileInputStream(file);

        byte[] buffer = new byte[(int) file.length()];

        inputFile.read(buffer);

        inputFile.close();

        return Base64.encodeToString(buffer, Base64.DEFAULT);
    }

}
